<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS技巧2</title>
    <style>
        /*行内元素水平垂直居中*/
        .outer{
            width: 400px;
            height: 400px;
            background-color: gray;
            text-align: center;  /*水平居中，找父元素*/
            line-height: 400px; /*垂直居中，都是找父元素*/
        }
        span {
            background-color: orange;
            font-size: 20px;
        }
    </style>
</head>
<body>
    <div class="outer">
        <span>出来完</span>
    </div>
    
</body>
</html>